<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-01-25 20:18:52
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-05-12 14:10:25
 * @FilePath     : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<div nz-row>
    <div nz-col nzSpan="24">
        <!-- <div class="mb-md ml-xl" style="text-align: right;">
            <button nz-button nzType="primary" (click)="add()">新增公里数</button>
            <button class="ml-md" nz-button nzType="primary" (click)="save()">保存</button>
        </div> -->
        <nz-table #groupingTable [nzData]="data" nzBordered nzSize="small" [nzFrontPagination]="false"
            [nzScroll]="{ y: '900px' }" [nzShowPagination]="false" class="ml-xl" style="max-width: 1000px;">
            <thead>
                <tr>
                    <th rowspan="2" nzWidth="60px" nzAlign="center" nzLeft>序号</th>
                    <th nzWidth="220px" nzAlign="center" >合伙人等级</th>
                    <th nzWidth="160px" *ngIf="type == '2'"  nzAlign="center" >初始业务量</th>
                    <th nzWidth="160px" *ngIf="type == '2'"  nzAlign="center" >到达业务量</th>
                    <th nzWidth="160px" nzAlign="center" >管理费比例%</th>
                    <th rowspan="2" nzWidth="60px" nzAlign="center" nzRight *ngIf="type == '2'">操作</th>
                </tr>
            </thead>
            <tbody>
                <tr *ngFor="let item of groupingTable.data;let i = index">
                    <td nzWidth="60px" nzAlign="center" nzLeft>
                        <div style="text-align: center;">
                            <div>
                                {{i + 1}}
                            </div>
                        </div>
                    </td>
                    <td nzWidth="220px" nzAlign="center" >
                        <div >
                            <nz-select *ngIf="type == '2'" style="min-width: 150px;" [(ngModel)]="item.gradeConfigId" >
                                <nz-option *ngFor="let item of grage" [nzValue]="item.id" [nzLabel]="item.gradeName" ></nz-option>
                            </nz-select>
                            <nz-select *ngIf="type == '1'" style="min-width: 150px;" [(ngModel)]="item.gradeConfigId" >
                                <nz-option  [nzValue]="'0'" nzLabel="全部等级" ></nz-option>
                            </nz-select>
                        </div>
                    </td>
                    <td nzWidth="160px" nzAlign="center" *ngIf="type == '2'" >
                        <div   >
                            <nz-input-group  nzPrefix="=" >
                            <nz-input-number nzPrefix="=" [(ngModel)]="item.startAmount" [nzMin]="0" [nzMax]="99999999"nzSize="small"  (ngModelChange)="changeendAmount($event,i)"
                               >
                            </nz-input-number>
                        </nz-input-group>
                     
                        </div>
                    </td>
                    <td nzWidth="160px" nzAlign="center" *ngIf="type == '2'"  >
                        <div   >
                            <nz-input-group  nzPrefix="＜">
                            <nz-input-number [(ngModel)]="item.endAmount" [nzMin]="0" [nzMax]="99999999" nzSize="small" >
                            </nz-input-number>
                        </nz-input-group>
                        </div>
                    </td>
                    <td nzWidth="160px" nzAlign="center" >
                        <div class="three" style="text-align: center;">
                            <nz-input-group [nzAddOnAfter]="addOnAfterTemplate2">
                            <nz-input-number [(ngModel)]="item.managementFeeRatio" [nzMin]="0"  [nzMax]="100"nzSize="small" 
                               >
                               <ng-template #addOnAfterTemplate2>
                                <span >%</span>
                            </ng-template>
                            </nz-input-number>
                            </nz-input-group>
                       
                        </div>
                    </td>
                    <td nzWidth="60px" nzAlign="center" nzRight *ngIf="type == '2'">
                        <a  style=" font-size: 20px;" nz-popconfirm
                            nzPopconfirmTitle="是否新增?" (nzOnConfirm)="add()"
                            >+</a>
                        <a style="margin-left: 10px; font-size: 20px;" *ngIf="i === groupingTable.data.length-1 && groupingTable.data.length>1"
                             nz-popconfirm
                            nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="deleteRow(i)"
                            >-</a>
                    </td>
                </tr>
            </tbody>
        </nz-table>


    </div>
</div>